#!/usr/bin/env bash 
 
echo "start install nginx" 

echo "开始进入解压..."
tar -zxvf /home/downloads/nginx-1.17.3.tar.gz -C /home/downloads/  
echo "解压成功"

echo "开始编译..."
cd /home/downloads/nginx-1.17.3 
./configure \
        --user=nginx --group=nginx \          
         --prefix=/usr/local/nginx \           
         --with-http_stub_status_module \        
         --with-http_ssl_module \              
         --with-http_sub_module \             
         --with-http_gzip_static_module          
     
make && make install
echo "编译成功..."
 
echo "删除已解压缩文件"
rm -rf /home/downloads/nginx-1.17.3 

echo "添加软连接,修改为默认版本"
ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/nginx

echo "nginx 安装成功"
echo "开始测试 nginx 是否安装看成。看下面输出"
nginx -v